import request from "@/utils/request";

export const getRoles = (data: unknown) => {
  return request({
    method: "POST",
    url: "/boss/role/getRolePages",
    data
  })
}

export const deleteRole = (id: string) => {
  return request({
    method: "DELETE",
    url: `/boss/role/${id}`,
  })
}

export const addOrUpdateRole = (data: unknown) => {
  return request({
    method: "POST",
    url: "/boss/role/saveOrUpdate",
    data
  })
}

export const getRoleById = (id: string | number) => {
  return request({
    method: "GET",
    url: `/boss/role/${id}`,
  })
}

export const getAllRoles = () => {
  return request({
    method: "GET",
    url: `/boss/role/all`,
  })
}

export const allocateUserRoles = (data: unknown) => {
  return request({
    method: "POST",
    url: "/boss/role/allocateUserRoles",
    data
  })
}

export const getUserRole = (userId: unknown) => {
  return request({
    method: "GET",
    url: `/boss/role/user/${userId}`,
  })
}